home *** CD-ROM | disk | FTP | other *** search
- Path: comma.rhein.de!yaps!arno
- From: arno@yaps.rhein.de (Arno Eigenwillig)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Setting DICE 3's variables to MEMF_PUBLIC
- Message-ID: <pKc0y*qzf@yaps.rhein.de>
- Date: Mon, 29 Jan 1996 17:57:45 +0100
- References: <4egfql$1lq@milo.freenet.vancouver.bc.ca>
- Organization: Yet Another Private Site in Meckenheim, Germany
- X-Copyright: This article may not be distributed on a CD-ROM
- or in printed form without prior written consent of the author.
-
- In article <4egfql$1lq@milo.freenet.vancouver.bc.ca>, Gordon Fecyk writes:
-
- > I use MEMF_PUBLIC for all my
- > AlocVec() and AllocMem() because all this data WILL get accessed
- > externally (mainly freshly drawn fonts, etc) but I have no control over
- > the memory the DICE startup code allocates, or the memory it sets aside
- > for its local variables.
-
- (Disclaimer: I am only familiar with V2 DICE, but the general problems
- should be the same.)
-
- Unless your program is compiled to be pure (can be made resident), the
- start-up code does not allocate memory. It does not allocate memory
- for static const variables even for pure programs. (What use is there
- in making a patch program resident anyway?)
-
- Non-__chip memory allocated by the OS at load time will be MEMF_PUBLIC
- (cf. Guru Book 22.2.1). (I am not sure about __chip-memory; maybe,
- maybe not, maybe Ralph is willing to clarify the issue.) This affects
- all static variables not dealt with in the previous paragraph.
-
- Automatic variables are "allocated" on the stack. That is, automatic
- variables of your patch code are placed on the stack of the task
- calling the patched function. This makes the question whether your
- stack is MEMF_PUBLIC irrelevant. But switch off all fancy stack-
- related features like dynamic stack extension!
-
- Only if you make a pointer to an automatic variable of a function
- running within your task's context visible to the patch code should
- the question whether your own stack is MEMF_PUBLIC be an issue. I am
- not sure. However, C= warns against using the stack for public data
- structures (cf. RKM I&A, p.6). But then, even existing C= example
- code does not take this too serious.
-
- -- __
- __/// Arno Eigenwillig /\ <arno@yaps.rhein.de> \/ PGP key available.
- \XX/ V+49-2225-5870 /\ <Arnooo @ #amigager> \/ MIME 8bit welcome.
-